import unittest


class TestFileWriteMethods(unittest.TestCase):

    """
    说明:
        1. w模式表示写入, 文件指针在开头, 所以会覆盖.
    """
    def test_write(self):
        f = open("b.txt", "w", encoding="utf-8")
        f.write("我是991264921")
        f.close()

    """
    说明:
        1. 以a模式打开文件表示追加, 文件指针会在末尾.
    """
    def test_append(self):
        f = open("b.txt", "a", encoding="utf-8")
        f.write("我是991264921\n")
        f.close()


if __name__ == '__main__':
    unittest.main()
